<!---->
<template>
    <div class="page_editsdqtx">
        <common-header :title="'水电气通讯编辑'">
            <span slot="overwrite-left"></span>
        </common-header>
        <div class="btn-save" @click="updateFamilyWaterElectricInfo()">保存</div>
        <div class="pages-main" style="height: calc( 100vh - 45px)">
            <div class="item-info">
                <div class="item-item">
                    <div class="item-item every-block-padding item-inline">
                        <span class="item-itemLabel">饮水情况</span>
                        <select class="translateBlock" v-model="info.drinkInfo"
                                style="text-align-last: right;;width: 7rem;font-size:0.38rem;">
                            <option v-for="item in drinkInfos" :value="item">{{item}}</option>
                        </select>
                    </div>
                    <div class="item-item every-block-padding item-inline">
                        <span class="item-itemLabel">通电情况</span>
                        <select class="translateBlock" v-model="info.powerInfo"
                                style="text-align-last: right;;width: 7rem;font-size:0.38rem;">
                            <option v-for="item in cases" :value="item">{{item}}</option>
                        </select>
                    </div>
                    <div class="item-item every-block-padding item-inline">
                        <span class="item-itemLabel">通气情况</span>
                        <select class="translateBlock" v-model="info.gasInfo"
                                style="text-align-last: right;;width: 7rem;font-size:0.38rem;">
                            <option v-for="item in cases" :value="item">{{item}}</option>
                        </select>
                    </div>
                    <div class="item-item every-block-padding item-inline">
                        <span class="item-itemLabel">道路情况</span>
                        <select class="translateBlock" v-model="info.loadInfo"
                                style="text-align-last: right;;width: 7rem;font-size:0.38rem;">
                            <option v-for="item in cases" :value="item">{{item}}</option>
                        </select>
                    </div>
                    <div class="item-item every-block-padding item-inline">
                        <span class="item-itemLabel">通讯覆盖</span>
                        <select class="translateBlock" v-model="info.correspondInfo"
                                style="text-align-last: right;;width: 7rem;font-size:0.38rem;">
                            <option v-for="item in correspondInfos" :value="item">{{item}}</option>
                        </select>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    import resident from '../../services/resident'

    export default {
        name: "editsdqtx",
        components: {},
        data() {
            return {
                info: {
                    familyId: Number(this.$route.query.familyid),
                    drinkInfo: this.$route.query.drinkInfo,
                    powerInfo: this.$route.query.powerInfo,
                    gasInfo: this.$route.query.gasInfo,
                    loadInfo: this.$route.query.loadInfo,
                    correspondInfo: this.$route.query.correspondInfo,
                },

                drinkInfos: ['自来水', '井水', '其他'],
                cases: ['是', '否'],
                correspondInfos: ['2G', '4G', '宽带', '2G和宽带', '4G和宽带', '未通',],
            }
        },

        created() {

        },
        watch: {},
        methods: {
            // 保存
            updateFamilyWaterElectricInfo() {
                let param = {
                    drinkInfo: '请选择饮水情况',
                    powerInfo: '请选择通电情况',
                    gasInfo: '请选择通气情况',
                    loadInfo: '请选择道路情况',
                    correspondInfo: '请选择通讯覆盖',
                }

                for (let i in param) {
                    if (!this.info[i]) {
                        this.$vux.toast.show({
                            text: param[i],
                            type: 'text',
                            position: 'middle',
                        })
                        return;
                    }
                }

                let _param = this.$tools.invokeUAF('resident/updateFamilyBaseInfo', this.info)
                resident.updateFamilyWaterElectricInfo(_param).then(res => {

                })
            }
            ,
        },
    };
</script>

<style lang="less" rel="stylesheet/less" type="text/less">
    .page_editsdqtx {
    }
</style>
